import React, { useState } from 'react'
import Son from './components/Son'

export default class App extends React.Component {
    state = {
        count:1
    }
    render() {
        console.log('App run')
        let {count} = this.state
        /**
         * setCount：如果设置的值不变，只多渲染一次
         */
        return (
            <div>
                <p>count:{count}</p>
                <p><button onClick={() => {
                    this.setState({
                        count: 2
                    })
                }}>count++</button></p>

                <hr />
                <Son count={count}/>
            </div>
        )
    }
}
